package cn.lfy.studentmanager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.lfy.studentmanager.dao.StudentDao;
import cn.lfy.studentmanager.domain.Student;
import cn.lfy.studentmanager.service.StudentService;
//此处注意要使用注解，这样才知道用到前面的service接口
@Service
public class StudentServiceImpl implements StudentService{
//这就是service接口实现类
	//注解注入dao,service调用dao，dao才是真正操作数据库的
	@Autowired
	private StudentDao studentDao;
	 
	@Override
	public boolean add(Student student) {
		return studentDao.add(student);
	}

	@Override
	public boolean delete(int id) {
		boolean isSuccess = studentDao.delete(id);
		return isSuccess;
		//返回dao中delete的处理结果
	}

	@Override
	public boolean update(Student student) {
		// TODO Auto-generated method stub
		return studentDao.update(student);
	}

	@Override
	public List<Student> select() {
		return studentDao.select();
	}

	@Override
	public Student query(int id) {
		
		return studentDao.query(id);
	}

}
